<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<jsp:include page="/admin/header.jsp"></jsp:include>
<div class="main">
	<div class="body container">
		<div class="typecho-page-title">
			<h2>
				管理文章<a href="${options.siteUrl}/admin/write-post">新增</a>
			</h2>
		</div>
		<div class="row typecho-page-main" role="main">
			<div class="col-mb-12 typecho-list">
				<div class="typecho-list-operate clearfix">
					<form method="get">
						<div class="operate">
							<label><i class="sr-only">全选</i><input type="checkbox"
								class="typecho-table-select-all"></label>
							<div class="btn-group btn-drop">
								<button class="btn dropdown-toggle btn-s" type="button">
									<i class="sr-only">操作</i>选中项 <i class="i-caret-down"></i>
								</button>
								<ul class="dropdown-menu">
									<li><a lang="你确认要删除这些文章吗?"
										href="${options.siteUrl}/action/admin?do=deletePosts">删除</a></li>
								</ul>
							</div>
						</div>
						<div class="search" role="search">
							<input type="text" class="text-s" placeholder="请输入关键字" value=""
								name="keywords"> <select name="category">
								<option value="">所有分类</option>
								<option value="1">默认分类</option>
							</select>
							<button type="submit" class="btn btn-s">筛选</button>
						</div>
					</form>
				</div>
				<!-- end .typecho-list-operate -->

				<form method="post" name="manage_posts" class="operate-form">
					<div class="typecho-table-wrap">
						<table class="typecho-list-table">
							<colgroup>
								<col width="20">
								<col width="6%">
								<col width="45%">
								<col width="">
								<col width="18%">
								<col width="16%">
							</colgroup>
							<thead>
								<tr>
									<th></th>
									<th></th>
									<th>标题</th>
									<th>作者</th>
									<th>分类</th>
									<th>日期</th>
								</tr>
							</thead>
							<tbody>
								<c:forEach var="post" items="${posts}">
									<tr id="post-${post['cid'] }">
										<td><input type="checkbox" value="${post['cid'] }"
											name="cid[]"></td>
										<td><a
											href="${options.siteUrl}/admin/manage-comments?cid=${post['cid'] }"
											class="balloon-button size-1">${post['commentsNum']}</a></td>
										<td><a
											href="${options.siteUrl}/admin/write-post?cid=${post['cid'] }">${post['title']}</a>
											<a href="${options.siteUrl}/post/${post['cid'] }"
											title="浏览${post['title']}" target="_blank"><i
												class="i-exlink"></i></a></td>
										<td><a
											href="${options.siteUrl}/admin/manage-posts?uid=${post['author']['uid']}">${post['author']['screenName']}</a></td>
										<td><c:forEach var="category"
												items="${post['categories']}">
												<span> <a
													href="${options.siteUrl}/admin/manage-categories?slug=${category['slug']}">${category['name']}</a>|
												</span>
											</c:forEach></td>
										<td>${post['created']}</td>
									</tr>
								</c:forEach>
							</tbody>
						</table>
					</div>
				</form>
				<!-- end .operate-form -->

				<div class="typecho-list-operate clearfix">
					<form method="get">
						<div class="operate">
							<label><i class="sr-only">全选</i><input type="checkbox"
								class="typecho-table-select-all"></label>
							<div class="btn-group btn-drop">
								<button class="btn dropdown-toggle btn-s" type="button">
									<i class="sr-only">操作</i>选中项 <i class="i-caret-down"></i>
								</button>
								<ul class="dropdown-menu">
									<li><a lang="你确认要删除这些文章吗?"
										href="${options.siteUrl}/action/admin?do=deletePosts">删除</a></li>
								</ul>
							</div>
						</div>
					</form>
				</div>
				<!-- end .typecho-list-operate -->
			</div>
			<!-- end .typecho-list -->
		</div>
		<!-- end .typecho-page-main -->
	</div>
</div>
<jsp:include page="/admin/copyright.jsp"></jsp:include>
<jsp:include page="/admin/common-js.jsp"></jsp:include>
<script>
	(function() {
		$(document).ready(function() {
			$('.typecho-list-table').tableSelectable({
				checkEl : 'input[type=checkbox]',
				rowEl : 'tr',
				selectAllEl : '.typecho-table-select-all',
				actionEl : '.dropdown-menu a,button.btn-operate'
			});

			$('.btn-drop').dropdownMenu({
				btnEl : '.dropdown-toggle',
				menuEl : '.dropdown-menu'
			});
		});
	})();
</script>
<jsp:include page="/admin/footer.jsp"></jsp:include>
